
import {
  Toast,
  ToastOptions,
} from 'vant';

export function startLoading(
  message: string = '加载中...',
  option: ToastOptions = {}
) {

  Toast.loading({
    message: message || '加载中...',
    forbidClick: true,
    duration: 0,
    ...option,
  });
}
export function hideLoading() {
  Toast.clear();
}

export function SuccessToast(
  message: string = '操作成功',
  option: ToastOptions = {}
) {
  Toast.success({
    message: message || '操作成功',
    duration: 2000,
    ...option,
  });
}

export function ErrorToast(
  message: string = '操作失败',
  option: ToastOptions = {}
) {
  Toast.fail({
    message: message || '操作失败',
    duration: 3000,
    ...option,
  });
}
